package com.app.TCES.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.app.TCES.domain.Course;

@Mapper
public interface A_CourseMapper {

	// 查询所有课程信息
	@Select("select * from course")
	List<Course> selectCourses();

	// 删除课程信息
	@Delete("delete from course where courseId=#{courseId}")
	void deleteCourse(@Param("courseId")int courseId);

	// 添加(查找课程ID是否存在)
	@Select("select count(*) from course where courseId=#{courseId}")
	int selectCourseId(@Param("courseId") int courseId);

	// 添加(查找课程Name是否存在)
	@Select("select count(*) from course where courseName=#{courseName}")
	int selectCourseName(@Param("courseName") String courseName);
	
	//添加
	@Insert("insert into course values(#{courseId},#{courseName})")
	void insertCourse(@Param("courseId")int courseId,@Param("courseName")String courseName);
}
